package com.campus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.campus.dao.TeacherStudentInClassMapper;
import com.campus.entry.TeachingStudentInClass;
import com.campus.service.TeacherStudentInClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service

public class TeacherStudentInClassServiceImpl implements TeacherStudentInClassService {
    @Autowired
    private TeacherStudentInClassMapper teacherStudentInClassMapper;
    @Override
    public void addStudent(Integer classId, List<Integer> studentIds) {
        List<TeachingStudentInClass> list=new ArrayList<>();
        for (Integer studentId : studentIds) {
            TeachingStudentInClass teachingStudentInClass=new TeachingStudentInClass()
                    .setClassId(classId)
                    .setStudentId(studentId);
            list.add(teachingStudentInClass);
        }
        teacherStudentInClassMapper.insert(list);
    }
}
